notebook: add an 'initial-gap' style property
authorCosimo Cecchi <cosimoc@gnome.org>
Wed, 9 Mar 2011 19:15:43 +0000 (14:15 -0500)
committerCosimo Cecchi <cosimoc@gnome.org>
Wed, 9 Mar 2011 19:15:43 +0000 (14:15 -0500)
It adds a gap before the first tab in the notebook.

https://bugzilla.gnome.org/show_bug.cgi?id=643841

gtk/gtknotebook.c

index e601bb7205b73b0cb97d80fb2abf091fdbd0db24..572ad69c36244d382347f368816450a40fa9ecd4 100644 (file)
@@ -903,6 +903,23 @@ gtk_notebook_class_init (GtkNotebookClass *class)
                                                              0,
                                                              GTK_PARAM_READABLE));
 
+  /**
+   * GtkNotebook:initial-gap:
+   *
+   * The "initial-gap" property defines the minimum size for the initial
+   * gap between the first tab.
+   *
+   * Since: 3.2
+   */
+  gtk_widget_class_install_style_property (widget_class,
+                                           g_param_spec_int ("initial-gap",
+                                                             P_("Initial gap"),
+                                                             P_("Initial gap before the first tab"),
+                                                             0,
+                                                             G_MAXINT,
+                                                             0,
+                                                             GTK_PARAM_READABLE));
+
   /**
    * GtkNotebook::switch-page:
    * @notebook: the object which received the signal.
@@ -5276,6 +5293,7 @@ gtk_notebook_tab_space (GtkNotebook *notebook,
   gint i;
   guint border_width;
   GtkBorder padding;
+  gint initial_gap;
 
   widget = GTK_WIDGET (notebook);
   children = priv->children;
@@ -5287,6 +5305,7 @@ gtk_notebook_tab_space (GtkNotebook *notebook,
                         "arrow-spacing", &arrow_spacing,
                         "scroll-arrow-hlength", &scroll_arrow_hlength,
                         "scroll-arrow-vlength", &scroll_arrow_vlength,
+                        "initial-gap", &initial_gap,
                         NULL);
 
   border_width = gtk_container_get_border_width (GTK_CONTAINER (notebook));
@@ -5294,6 +5313,9 @@ gtk_notebook_tab_space (GtkNotebook *notebook,
 
   gtk_widget_get_allocation (widget, &allocation);
 
+  allocation.x += initial_gap;
+  allocation.width -= 2 * initial_gap;
+
   switch (tab_pos)
     {
     case GTK_POS_TOP: